package com.ymatou.iapi.godmch.service;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.google.gson.JsonSyntaxException;
import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*批量获取代理推广关系Call
*FreeMaker Template自动生成代码
*/
public class getAgentPromoteRelationCall extends YmatouBaseCall{
	private static String opurl ="api/agent/getAgentPromoteRelation";
	
	public getAgentPromoteRelationCall() {
		super(EnvSetup.getSystemUrl("godmch_iapi"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	 public String getStatusCode1()
		{
		  return getString("status");
		}
	 
	 public JSONArray getRelations() throws JsonSyntaxException, JSONException {

		 JSONArray jArray =new JSONObject(new JSONObject(getString("result").toString()).getJSONArray("list").get(0).toString()).getJSONArray("relations");
		 
		return jArray;
	}
	 
	 
	 public JSONArray getList() throws JsonSyntaxException, JSONException {

		 JSONArray jArray =new JSONObject(getString("result").toString()).getJSONArray("list");
		 
		return jArray;
	}
	 
}